package dating.service;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
	 try {
		 sessionFactory = new AnnotationConfiguration().configure("resources/datingDS-ds.xml").buildSessionFactory();
	 } catch (Throwable ex) {
		 System.err.println("Initial SessionFactory creation failed." + ex);
		 throw new ExceptionInInitializerError(ex);
	 }
}

public static Session openSession() {
	 return sessionFactory.openSession();
}
}
